﻿//11.盛最多水的容器
class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0, right = height.size() - 1;
        int max = 0;
        while (left < right)
        {
            int now = (right - left) * (height[left] > height[right] ? height[right] : height[left]);
            if (now > max)
            {
                max = now;
            }

            if (height[left] < height[right])
            {
                left++;
            }
            else
            {
                right--;
            }
        }
        return max;
    }
};